import requests

class APIClient:
    def __init__(self, base_url: str):
        self.base_url = base_url

    def submit_task(self, command: str, machine_id: str):
        url = f"{self.base_url}/submit_task/"
        payload = {
            "command": command,
            "machine_id": machine_id
        }
        response = requests.post(url, json=payload)
        if response.status_code == 200:
            return response.json()
        else:
            response.raise_for_status()

    def reset_task(self, task_id: str):
        url = f"{self.base_url}/reset_task/"
        params = {"task_id": task_id}
        response = requests.get(url, params=params)
        if response.status_code == 200:
            return response.json()
        else:
            response.raise_for_status()

    def task_status(self, task_id: str):
        url = f"{self.base_url}/task_status/{task_id}"
        response = requests.get(url)
        if response.status_code == 200:
            return response.json()
        else:
            response.raise_for_status()
    
    def delete_task(self, task_id: str):
        url = f"{self.base_url}/delete_task/{task_id}"
        response = requests.delete(url)
        if response.status_code == 200:
            return response.json()
        else:
            response.raise_for_status()
